home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games Extra 1996 September
/
Amiga Games Extra CD-ROM 9-1996.iso
/
userbox
/
publicdomain
/
aplayer
/
typesort.aplay
< prev
next >
Wrap
Text File
|
1995-05-26
|
2KB
|
95 lines
/* This procedure will sort all your modules into the types */
ADDRESS APlayer
OPTIONS RESULTS
SIGNAL ON HALT
PARSE ARG moddir
msg= "This script will sort all your modules into different categories."||'0A'X
msg=msg||"WARNING! ONLY USE THIS ON YOUR MODULE DIRECTORY"||'0A'X
msg=msg||"*NOT* ON YOUR SYS: DH0: OR OTHER ROOT DIRECTORIES."||'0A'X
msg=msg||'0A'X
msg=msg||"Do you want to continue?"
Request "Okay|Cancel!" msg
IF RESULT=0 THEN EXIT
IF moddir = '' THEN DO
GetDir "Select the root of your modules"
IF RC=0 THEN
moddir=RESULT
END
IF moddir ~='' THEN DO
IF RIGHT(moddir,1)~=':' & RIGHT(moddir,1)~='/' THEN
moddir=moddir||'/'
/* Add the functions of the 'rexxsupport.library' */
IF ADDLIB('rexxsupport.library',0,-30,0) = 0 THEN DO
IF SHOW('L','rexxsupport.library') = 0 THEN DO
Request "Okay" 'Couldn''t open rexxsupport.library'
EXIT 10
END
END
/* Get the contents of the module directory */
SetCycle RexxMsg; RexxMsg "Scanning directory..."
modlist = SHOWDIR(moddir,'F',';')||';'
IF modlist~=';' THEN DO
DO UNTIL modlist=''
ClearList
modname=LEFT(modlist,INDEX(modlist,';')-1)
RexxMsg "Loading/testing module..."
AddMod moddir||modname
PlayMod 1
GetPlayer
type=SPACE(RESULT,1,'_')
IF type~='???' THEN DO
IF ~EXISTS(moddir||type) THEN DO
RexxMsg "Making "||type||" directory..."
CALL makedir(moddir||type)
END
type=type||'/'
okay=1
IF EXISTS(moddir||type||modname) THEN DO
Request "Overwrite|Skip" "File"||'0A'X||moddir||type||modname||'0A'X||"already exists!"
okay=RESULT
END
IF okay THEN DO
RexxMsg "Moving file:"||modname
CALL rename(moddir||modname,moddir||type||modname)
CALL rename(moddir||modname||'.info',moddir||type||modname||'.info')
tmpname=UPPER(modname)
IF LEFT(tmpname,5)='MDAT.' THEN
modname=RIGHT(modname,LENGTH(modname)-5)
modname=INSERT('SMPL.',modname)
CALL rename(moddir||modname,moddir||type||modname)
END
END
DelMod 1
modlist=DELSTR(modlist,1,INDEX(modlist,';'))
END
END
RexxMsg "Finished...."
END
EXIT
/*
This is the 'emergencybrake' part of this script. If you can't stop this
sucker run the program HI which is located in the RXC drawer on your
sys: partition.
*/
HALT:
Say 'The TypeSort.aplay script has been stopped. Hope you liked it.'
EXIT